package com.ys.erp.entity.data.bean;

import com.baomidou.mybatisplus.annotation.*;

import java.time.LocalDateTime;
import java.util.HashMap;
import java.util.Map;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.Getter;

/**
 * @author lwj
 * @date 2025/5/16
 */
    
@Data
@TableName(value = "t_cat_money_order")
public class CatMoneyOrder {
    /**
     * 订单id
     */
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    /**
     * 用户id
     */
    @TableField(value = "user_id")
    private Long userId;

    /**
     * 猫咪钱包id
     */
    @TableField(value = "user_cat_id")
    private Long userCatId;

    /**
     * 订单号
     */
    @TableField(value = "order_no")
    private String orderNo;

    /**
     * 充值金额单位分
     */
    @TableField(value = "pup_amount")
    private Long pupAmount;

    /**
     * 实际支付金额
     */
    @TableField(value = "actual_amount")
    private Long actualAmount;

    /**
     * 赠送类型，YS_MONEY：幺币，YS_PULSE：幺豆
     */
    @TableField(value = "gift_type")
    private String giftType;

    /**
     * 赠送金额
     */
    @TableField(value = "gift_amount")
    private Long giftAmount;

    /**
     * 订单状态
     */
    @TableField(value = "pay_status")
    private String payStatus;

    /**
     * 支付时间
     */
    @TableField(value = "pay_time")
    private LocalDateTime payTime;

    /**
     * 支付方式
     */
    @TableField(value = "pay_type")
    private String payType;

    /**
     * 流水id
     */
    @TableField(value = "pay_id")
    private Long payId;

    /**
     * 超时时间
     */
    @TableField(value = "out_time")
    private LocalDateTime outTime;

    /**
     * 版本号
     */
    @TableField(value = "version")
    @Version
    private Integer version;

    /**
     * 创建时间
     */
    @TableField(value = "create_time")
    private LocalDateTime createTime;

    /**
     * 更新时间
     */
    @TableField(value = "update_time", update = "now()")
    private LocalDateTime updateTime;

    @AllArgsConstructor
    @Getter
    public enum Enums {
        PAY_UN_PAY,
        PAY_PAYING,
        PAY_SUCCESS,
        PAY_FAIL,

        YS_MONEY,
        YS_PULSE,
        ;
    }

    public static final Map<String, String> ENUM_MAP = new HashMap<>();

    static {
        ENUM_MAP.put(Enums.PAY_UN_PAY.toString(), "待支付");
        ENUM_MAP.put(Enums.PAY_PAYING.toString(), "支付中");
        ENUM_MAP.put(Enums.PAY_SUCCESS.toString(), "支付成功");
        ENUM_MAP.put(Enums.PAY_FAIL.toString(), "支付失败");

        ENUM_MAP.put(Enums.YS_MONEY.toString(), "幺币");
        ENUM_MAP.put(Enums.YS_PULSE.toString(), "幺豆");
    }

    public static boolean isContainsKey(String key) {
        return ENUM_MAP.containsKey(key);
    }

}